package com.ouwen.smartpay.service.impl;

import com.ouwen.smartpay.service.InitService;
import com.ouwen.smartpay.service.chain.slotchain.SlotChainBuilder;
import com.ouwen.smartpay.service.chain.slots.DefaultSlotChainBuilder;
import com.ouwen.smartpay.service.chain.spi.SpiLoader;
import org.springframework.stereotype.Service;

/**
 * @author <a href="http://youngitman.tech">青年IT男</a>
 * @version v1.0.0
 * @className InitServiceImpl
 * @description
 * @JunitTest: {@link  }
 * @date 2020-05-27 10:16
 **/
@Service
public class InitServiceImpl implements InitService {


    /*** 默认设置tps 100/s */
    private int defaultTps = 100;

    @Override
    public void init() {

        //初始化spi加载
        initSpi();

    }

    private void initSpi() {
        SpiLoader.loadFirstInstanceOrDefault(SlotChainBuilder.class, DefaultSlotChainBuilder.class);
    }

    @Override
    public void refresh() {

    }

}
